#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <time.h>

time_t time_cnt;
struct tm time_date;

int main(void)
{
	//time_cnt = time(NULL);//获取电脑里当前时间的时间戳
	time(&time_cnt);//获取电脑里当前时间的时间戳
	printf("%d\n", time_cnt);//打印电脑里当前时间的时间戳

	time_date = *localtime(&time_cnt);//当地当前时间戳下时间
	printf("%d\n", time_date.tm_year + 1900);
	printf("%d\n", time_date.tm_mon + 1);
	printf("%d\n", time_date.tm_mday );
	printf("%d\n", time_date.tm_hour );
	printf("%d\n", time_date.tm_min );
	printf("%d\n", time_date.tm_sec );
	printf("%d\n", time_date.tm_wday );

	time_cnt = mktime(&time_date);//将当地时间转化为时间戳
	printf("%d\n", time_cnt);
}